[jQuery] Refactoring Tabs

Posted by Nimbuz on Stack Overflow See other posts from Stack Overflow or by Nimbuz
Published on 2010-06-14T17:38:39Z Indexed on 2010/06/14 17:42 UTC
Read the original article Hit count: 166

Filed under:
|
|
$('#mode li:first').addClass('active');
$('#mode li.active').append('<span class="arrow">&nbsp;</span>');
$('#mode li a').click(function () {
    $('#mode li').removeClass('active')
    $('.arrow').remove();
    $(this).parent().addClass('active').append('<span class="arrow">&nbsp;</span>');
    var a = $(this).attr('href');
    $('.tab-content').hide();
    $(a).show();
    return false;
});

.. works, but looking ugly. Can it be simplified/reduced further?

Many thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about refactoring